
/* 游戏数据配置 */
const size = 450; // 棋盘尺寸
const lineCounts = 15; // 棋盘行数
const rowWidth = size / lineCounts; // 棋盘行宽
const margin = rowWidth / 2; // 棋盘边界
const pieceRadius = rowWidth / 2; // 棋子半径
const offset = 2; // 渐变偏移
const conJunctions = 5; // 五子棋，五子连珠
var order = true; // 黑先; 白后
var mode = false; // Player Vs Player; Player Vs Computer;

var player = order;
var ord = {
    true: "先手执黑",
    false: "后手执白"
}
var mod = {
    true: "人人对战",
    false: "人机对战"
}
var records = {
    win: 0,
    lose: 0
};

/* ----- */
document.getElementById("order").innerText = ord[order];
document.getElementById("mode").innerText = mod[mode];
/* ----- */

function changeOrder() {
    order = !order;
    document.getElementById("order").innerText = ord[order];
    start();
}

function changeMode() {
    mode = !mode;
    // 清零记录
    records = {
        win: 0,
        lose: 0
    };
    updateRecords();
    if (mode) { // 人人对战不计分
        document.getElementById("records").style.display = "none";
    } else {
        document.getElementById("records").style.display = "block";
    }
    document.getElementById("mode").innerText = mod[mode];
    start();
}